

<div class="mws-panel grid_8 branches form">

    <div class="mws-panel-header"><span class="mws-i-24 i-table-1"><?php echo __('Students'); ?></span>
    </div>

    <div class="mws-panel-body">


        <div class="e_right" style="margin: 10px;"><?php
//foreach ($stages as $key=>$value) {
//	echo  $this->Html->link($value, array('action' => 'add',$key),array("class"=>"e_right mws-button red mws-i-24 i-books large f_large","style"=>"width:220px")); //<input type="button" class="mws-button red mws-i-24 i-cog large" value="Red">
//	echo '<div class="clear" ></div>';
//}
//debug($stages_branche);
?></div>

        <div class="mws-panel grid_8">
            <div class="mws-tabs ui-tabs ui-widget ui-widget-content ui-corner-all">

                <ul
                    class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">

                    <?php
                    $branches_parents = array();
                    $branches_child = array();
                    $i = 0;
                    foreach ($stages_branche as $key => $value) {
                        if (!$i)
                            echo '<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active f_medium"><a href="#tab-' . $value["Stage"]["id"] . '">' . $value["Stage"]["name"] . '</a></li>'; //$this->Html->link($value, array('action' => 'add',$key),array("class"=>"e_right mws-button red mws-i-24 i-books large f_large","style"=>"width:220px")); //<input type="button" class="mws-button red mws-i-24 i-cog large" value="Red">
                        else
                            echo '<li class="ui-state-default ui-corner-top f_medium"><a href="#tab-' . $value["Stage"]["id"] . '">' . $value["Stage"]["name"] . '</a></li>';
                        $i++;
                    }
                    ?>


                </ul>
                <?php
                foreach ($stages_branche as $stages) {
                    echo '<div id="tab-' . $stages["Stage"]["id"] . '" class="ui-tabs-panel ui-widget-content ui-corner-bottom"> '; //$this->Html->link($value, array('action' => 'add',$key),array("class"=>"e_right mws-button red mws-i-24 i-books large f_large","style"=>"width:220px")); //<input type="button" class="mws-button red mws-i-24 i-cog large" value="Red">
                    ?> 

                    <?php
                    foreach ($stages["Branch"] as $value) {

                        $branches_parents[$stages["Stage"]["level"]][$value["id"]] = $value["name"];
                    }
                    if (!empty($branches_parents[$stages["Stage"]["level"]])) {
                        ?>

                        <table class="mws-table border_all" >
                            <thead>
                                <tr>
                                    <th>
                                        <?php echo __("Action") ?>
                                    </th>
                                    <th>		
                                        <?php echo __("Branch"); ?>
                                    </th>
                                </tr>
                            </thead>
                            <tbody>


                                <?php
                                foreach ($stages["Branch"] as $key => $value) {

                                    echo '<tr>
		
                                    <td>
                                            <span class ="mws-ic ic-reseller-programm  add_subject">' ./*$this->Form->create('Periodexam',array("class"=>"mws-form")).'<input type="submit" class="mws-button orange mws-i-24 i-check large" value="'. __('Submit').'">'.$this->Form->input('uniyear_id',array("div"=>false,"label"=>false)).$this->Form->end().*/ $this->Html->link(__('View Students') . " ", array('action' => 'index', $value["id"]), array("class" => "f_large color_3")) . '
                                    </span>
                                            </td>
                                            <td >' . $this->Html->link($value["name"], array('action' => 'add', $value["id"]), array("class" => "e_right f_large ")) . '</td>
                                    </tr>';

                                    echo '<div class="clear" ></div>';
                                }
                                ?> 
                            </tbody>
                        </table>







                        <div class="clear" ></div>
                        <?php
                    } else {
                        echo '<div class="mws-form-message info f_large" id="flashMessage">لا يوجد شعب فى هذه الفرقة </div>';
                    }
                    ?>
                </div>


            <?php } ?>

        </div>
    </div>
    <div class="clear" ></div> 
</div>
</div>


